home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 May: Tool Chest / Developer CD Series Tool Chest (Apple Computer)(May 1999).iso / Tool Chest / Development Kits / MPW Related / DTS MPW Goodies / CheckedOutFiles < prev    next >
Encoding:
Text File  |  1990-09-14  |  3.8 KB  |  142 lines  |  [TEXT/MPS ]

  1. #
  2. #    File:        CheckedOutFiles
  3. #
  4. #    Contains:    script to echo names of files checked out modifiable in a project
  5. #
  6. #    Usage:        CheckedOutFiles [-project project | -m]
  7. #
  8. #    Status:        CheckedOutFiles may return the following status values:
  9. #
  10. #                    0        success
  11. #                    1        error
  12. #
  13. #    Written by:    scott douglass and Darin Adler
  14. #
  15. #    Copyright:    © 1988-1990 by Apple Computer, Inc., all rights reserved.
  16. #
  17. #    Change History (most recent first):
  18. #
  19. #         <9>     1/31/90    sad        add quoting in FileVersInfo test
  20. #        12/6/89        sad        better parsing of ProjectInfo
  21. #        11/15/89    dba        fix comments
  22. #        11/13/89    sad        redirect ProjectInfo not an author warnings
  23. #        11/9/89        dba        twiddled relentlessly
  24. #        11/8/89        dba        fix quoting in irrelevant ways
  25. #        8/7/89        sad        fix no -project case
  26. #        7/20/89        sad        add -project option
  27. #        5/26/89        sad        change parsing of ProjectInfo output for new Shell
  28. #        2/17/89        sad        written from CheckInAll
  29. #
  30. #    To Do:
  31. #        handle file names with spaces
  32. #
  33.  
  34. Alias UsageError 'Alert "“{0} {Parameters}” doesn’t make sense.∂nUsage:  “{0} [-project project | -m]”" ; Exit 1'
  35.  
  36. Set Exit 0
  37.  
  38. Begin
  39.  
  40.     Set Options ""
  41.     Set Project ""
  42.  
  43.     If {#} == 2 && "{1}" =~ /-project/
  44.         If {Options} == ""
  45.             Set Options "-project"
  46.             Set Project ∂""{2}∂""
  47.         Else
  48.             UsageError
  49.         End
  50.     Else If {#} == 1 && "{1}" =~ /-m/
  51.         If {Options} == ""
  52.             Set Options "-m"
  53.         Else
  54.             UsageError
  55.         End
  56.     Else If {#} ≠ 0
  57.         UsageError
  58.     End
  59.  
  60.     # first get all the check-out directories for the current project
  61.  
  62.     Set CheckOutDirs "`CheckOutDir -r {Options} {Project}; Set CheckOutDirStatus {Status}; Echo`"
  63.     If {CheckOutDirStatus}
  64.         Echo "### {0} - CheckOutDir failed." > Dev:StdErr
  65.         Exit 1
  66.     End
  67.  
  68.     Loop
  69.         Break If "{CheckOutDirs}" !~ / *CheckOutDir +-project ∂'«0,1»([¬:]+∫)®1∂'«0,1» ∂'«0,1»([¬∫]*:)®2∂'«0,1» (≈)®3/
  70.         Set Project "{®1}"
  71.         Set CheckOutDir "{®2}"
  72.         Set CheckOutDirs "{®3}"
  73.  
  74.         # now for each directory, get all modified files in the project
  75.  
  76.         Set Info "`ProjectInfo -s -a "{User}" -m -project "{Project}" ≥ Dev:Null; Set ProjectInfoStatus {Status}`"
  77.         If {ProjectInfoStatus}
  78.             Echo "### {0} - ProjectInfo of “{Project}” failed." > Dev:StdErr
  79.             Exit 1
  80.         End
  81.  
  82.         Continue If "{Info}" == ""
  83.  
  84.         If "{Info}" =~ /∂'«0,1»?+∫∂'«0,1»(≈)®1/
  85.             Set Info "{®1}"
  86.         Else
  87.             Echo "### {0} - Couldn’t parse Info: “{Info}”" > Dev:StdErr
  88.             Exit 1
  89.         End
  90.  
  91.         Loop
  92.             Break If "{Info}" !~ /[¬+]*     «0,1»∂'([¬,]+)®1,([0-9.a-z]+∂+)®2∂' (≈)®3/
  93.             Set ProjectFileName "{®1}"
  94.             Set ProjectVersInfo "{®2}"
  95.             Set Info "{®3}"
  96.  
  97.             Set DirFile "{CheckOutDir}{ProjectFileName}"
  98.  
  99.             If `Exists "{DirFile}"`"" ≠ ""
  100.                 Quote "{DirFile}"
  101.  
  102.                 Begin
  103.                     Set FileInfo "`ProjectInfo "{DirFile}"`"
  104.                     If "{FileInfo}" =~ /∂'«0,1»([¬,]+)®1,([0-9.a-z]+[+*]«0,1»)®2∂'«0,1»(     WARNING: this file has been renamed!)«0,1»≈Project: ([¬:]+∫)®5     Checked out: ≈/
  105.                         Set FileFileName "{®1}"
  106.                         Set FileVersInfo "{®2}"
  107.                         Set VersInfo "({FileVersInfo} vs {ProjectVersInfo})"
  108.                         Set FileProject "{®5}"
  109.  
  110. #                        If `RelString "{FileProject}" "{Project}"` ≠ 0
  111.                         If "{FileProject}" ≠ "{Project}"
  112.                             Echo -n "### "
  113.                             Quote -n File "{DirFile}"
  114.                             Echo " is in the wrong project (“{FileProject}” vs “{Project}”)"
  115.                         Else If "{FileVersInfo}" ≠ "{FileVersInfo}"
  116.                             Echo -n "### "
  117.                             Quote -n File "{DirFile}"
  118.                             Echo " is wrong version ({FileVersInfo} vs {ProjectVersInfo})"
  119.                         End
  120.                     Else
  121.                         Echo "### {0} - Couldn’t parse FileInfo: “{FileInfo}”"
  122.                         Exit 1
  123.                     End
  124.                 End > Dev:StdErr
  125.             Else
  126.                 Echo -n "### "
  127.                 Quote -n File "{ProjectFileName}"
  128.                 Echo " is checked out from “{Project}” but not in the directory “{CheckOutDir}”." > Dev:StdErr
  129.             End
  130.         End
  131.         If "{Info}" ≠ ""
  132.             Echo "### {0} - Couldn’t parse Info: {Info}" > Dev:StdErr
  133.             Exit 1
  134.         End
  135.     End
  136.     If "{CheckOutDirs}" ≠ ""
  137.         Echo "### {0} - Couldn’t parse CheckOutDirs: {CheckOutDirs}" > Dev:StdErr
  138.         Exit 1
  139.     End
  140.  
  141. End
  142.